<script>
export default {
  name: 'MyMessage',
  data() {
    return {
      messageList: [
        {"id":1,"content":"消息一"},
        {"id":2,"content":"消息二"},
        {"id":3,"content":"消息三"}
      ]
    }
  },
  methods: {
    pushShow(id, content) {
      this.$router.push({
        name: 'detail',
        params: {
          id:id,
          content:content
        }
      })
    },
    replaceShow(id, content) {
      this.$router.replace({
        name: 'detail',
        params: {
          id:id,
          content:content
        }
      })
    }
  }
}
</script>

<template>
  <div>
    <ul>
      <li v-for="m in messageList" :key="m.id">
        <button @click="pushShow(m.id, m.content)">push查看</button>
        <button @click="replaceShow(m.id, m.content)">replace查看</button>
      </li>
    </ul>
    <router-view></router-view>
  </div>
</template>

<style>

</style>